#include "StdAfx.h"
#include "Mesh.h"
#include "MeshManager.h"

#include "MeshInstance.h"

using namespace RenderSystem;

//////////////////////////////SubMesh////////////////////////////////////////
SubMesh::SubMesh( void )
{
}

SubMesh::~SubMesh( void )
{
}

void SubMesh::SetMaterial( Material* pMaterial )
{
	m_pMaterial = pMaterial;
}

Material* SubMesh::GetMaterial( void ) const
{
	return m_pMaterial;
}

//////////////////////////////Mesh////////////////////////////////////////
Mesh::Mesh( const String& strId, MeshManager& rMeshMgr )
	:Resource(strId,rMeshMgr)
{
}

Mesh::~Mesh(void)
{
}

Instance* Mesh::_CreateInstanceImpl( const String& strInstanceId )
{
	return new MeshInstance( strInstanceId, this );
}

uint32 Mesh::GetSubMeshCount( void )
{
	return m_subMeshes.size();
}

SubMesh* Mesh::GetSubMesh( uint32 uIdx ) const
{
	assert( uIdx < m_subMeshes.size() );
	return m_subMeshes[uIdx];
}